//
//  WSAddCVItemTwo.m
//  Home
//
//  Created by 吴军虎吴军虎 on 16/6/7.
//  Copyright © 2016年 LanJue. All rights reserved.
//

#import "WSAddCVItemTwo.h"

@interface WSAddCVItemTwo ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *moneyLabel;
@property (nonatomic, strong) UIImageView *yesImage;
@property (nonatomic, strong) UIImageView *jImageView;

@end

@implementation WSAddCVItemTwo

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self createSubView];
        
        UIView *lineView = [[UIView alloc] init];
        [self addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.right.bottom.mas_equalTo(@0);
            make.height.mas_equalTo(@1);
        }];
        lineView.backgroundColor = LINECOlOR;
    }
    return self;
}

- (void)createSubView {
    
    //名字
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.font = [UIFont fontWithName:ZIXING size:TEXTCONTENTFONT*TEXTWEIGHT];
    self.titleLabel.textColor = HS;
    [self.contentView addSubview:_titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(15*AUTO_HEIGHT);
        //        make.centerY.equalTo(self.contentView);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
    }];
    
    //绿色图片
    self.jImageView = [[UIImageView alloc]initWithFrame:CGRectMake(310.00*AUTO_WIDTH, 15.00*AUTO_WIDTH, 40.00*AUTO_WIDTH, 40.00*AUTO_WIDTH)];
    self.jImageView.image = [UIImage imageNamed:@"jiantou"];
    [self.contentView addSubview:_jImageView];
    [self.jImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(15.00 *AUTO_HEIGHT);
        //        make.centerY.equalTo(self.contentView);
        make.right.mas_equalTo(-21.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(18.00*AUTO_WIDTH, 18.00*AUTO_WIDTH));
        
    }];
    
    //选填
    self.contentLabel = [[UILabel alloc] init];
    self.contentLabel.font = [UIFont fontWithName:@"Arial" size:TEXTCONTENTFONT*TEXTWEIGHT];
    self.contentLabel.textColor = TextLightGrayColor;
    self.contentLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.jImageView.mas_left).offset(-6.00*AUTO_WIDTH);
        
    }];
    
    //我的经历图片
    self.yesImage = [[UIImageView alloc]init];
    self.yesImage.image = [UIImage imageNamed:@""];
    //    self.yesImage.backgroundColor = LV;
    [self.contentView addSubview:_yesImage];
    [self.yesImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self).offset(-5);
        make.size.mas_equalTo(CGSizeMake(KScreenWidth, 30));
        //        make.centerY.equalTo(self.contentView);
        //        make.right.equalTo(self.jImageView.mas_left).offset(-6.00*AUTO_WIDTH);
        //        make.size.mas_equalTo(CGSizeMake(18.00*AUTO_WIDTH, 18.00*AUTO_WIDTH));
        
    }];
    
    
    self.addLabel = [[UILabel alloc] init];
    [self.yesImage addSubview:self.addLabel];
    self.addLabel.text = @"+添加教育经历";
    self.addLabel.textColor = GH;
    self.addLabel.textAlignment = NSTextAlignmentCenter;
    
    self.addLabel.font = [UIFont fontWithName:ZIXING size:TEXTCONTENTFONT*TEXTWEIGHT];
    //    self.addLabel.textColor = HS;
    [self.addLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.yesImage.mas_top).offset(5);
        make.size.mas_equalTo(CGSizeMake(KScreenWidth, 20));
        //        make.center.mas_equalTo(self.contentView);
    }];
    
    
    
}

- (void)setTitleStr:(NSString *)titleStr {
    
    _titleStr = titleStr;
    self.titleLabel.text = _titleStr;
}

- (void)setType:(NSInteger)type {
    
    if (_type != type) {
        _type = type;
        if (_type == 1) {
            self.contentLabel.hidden = NO;
            self.yesImage.hidden = YES;
            self.yesImage.hidden = YES;
        } else if (_type == 2) {
            self.contentLabel.hidden = YES;
            self.yesImage.hidden = NO;
        } else if (_type == 3) {
            self.contentLabel.hidden = YES;
            self.yesImage.hidden = YES;
            self.jImageView.hidden = YES;
        } else {
            self.contentLabel.hidden = NO;
            self.yesImage.hidden = YES;
        }
    }
}

- (void)setContent:(NSString *)content {
    
    _content = content;
    self.contentLabel.text = _content;
}

@end
